/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ticketmaster.businesslogic;


import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import javax.sql.RowSet;
import ticketmaster.dao.BookedTicketViewDAO;
import ticketmaster.dao.DAOFactory;
import ticketmaster.dao.VenueDAO;
import ticketmaster.dataobject.BookedTicketView;
import ticketmaster.dataobject.Customer;
import ticketmaster.dataobject.Event;
import ticketmaster.dataobject.Venue;

/**
 *
 * @author Varadha
 */
public class BookedTicketViewController {

    public RowSet getLocation()
    {
        VenueDAO vDAO = DAOFactory.getInstance().getVenueDAO();
        RowSet rs = vDAO.getLocation();
        return rs;
    }

    public Vector getEventday(Event[] event) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getEventDay(event);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();
            
            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);

        }
        return cache;
    }

    public Vector getEventyear(Event[] event) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getEventYear(event);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);
        }
        return cache;
    }

    public Vector getEventmonth(Event[] event) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getEventMonth(event);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 4; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);
        }
        return cache;
    }

    public Vector getAlltime(Event[] event) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getAlltime(event);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 2; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);
        }
        return cache;
    }


    public Vector getVenuemonth(Venue[] venue) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getVenueMonth(venue);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 4; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);
        }
        return cache;
    }

    public Vector getVenueDay(Venue[] venue) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getVenueDay(venue);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);
        }
        return cache;
    }

    public Vector getVenueYear(Venue[] venue) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getVenueYear(venue);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);
        }
        return cache;
    }

    public Vector getLocationYear(String[] Location) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getLocationYear(Location);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);
        }
        return cache;
    }

    public Vector getLocationMonth(String[] Location) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getLocationMonth(Location);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 4; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);
        }
        return cache;
    }

    public Vector getLocationDay(String[] Location) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getLocationDay(Location);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);
        }
        return cache;
    }

    public Vector getCustomerday(Customer[] cust) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getCustomerDay(cust);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);

        }
        return cache;
    }

    public Vector getCustomeryear(Customer[] cust) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getCustomerYear(cust);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);
        }
        return cache;
    }

    public Vector getCustomermonth(Customer[] cust) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getCustomerMonth(cust);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 4; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);
        }
        return cache;
    }

    public Vector getCustomerRange(Customer[] cust, String frm, String to) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getCustomerRange(cust, frm, to);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);

        }
        return cache;
    }
    public Vector getEventRange(Event[] evt, String frm, String to) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getEventRange(evt, frm, to);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);

        }
        return cache;
    }


    public Vector getVenueRange(Venue[] venue, String frm, String to) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getVenueRange(venue, frm, to);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);

        }
        return cache;
    }

    public Vector getLocationRange(String[] Location, String frm, String to) throws SQLException
    {
        Vector cache = new Vector();
        BookedTicketViewDAO bkvDAO = DAOFactory.getInstance().getBookedTicketViewDAO();

        RowSet rs = bkvDAO.getLocationrange(Location, frm, to);

        if(rs == null)
            return cache;

        while(rs.next())
        {
            Vector<String> row = new Vector <String>();

            for (int i = 0; i < 3; i++)
            {
                 row.addElement(rs.getString(i + 1));
            }
            cache.addElement(row);

        }
        return cache;
    }

}
